package com.senmin.aPrinciple.a1SingleResponsibilityPrinciple.tdemo1;

/**
 * @className: SingleResponsibility1
 * @author: xpj
 * @create: 2021/6/16
 * @description: 单一职责反例
 */
public class SingleResponsibility3 {
    public static void main(String[] args) {
        Vehicle  vehicle = new  Vehicle();
        vehicle.run("摩托车");
        vehicle.run("汽车");
        vehicle.runAir("飞机");
        vehicle.runWater("轮船");
    }

    //方式3分析：
    //1.这种修改方法对原来的类做大的修改，只是增加了方法。
    //2.这里虽然没有在类这个级别上遵守单一原则，但是在方法级别上仍然遵守了单一原则
    //3.
    static class Vehicle {
        public void run (String vehicle){
            System.out.println(vehicle + "在公路上运行！");
        }

        public void runAir (String vehicle){
            System.out.println(vehicle + "在天空中上运行！");
        }

        public void runWater (String vehicle){
            System.out.println(vehicle + "在水中中上运行！");
        }

    }

}
